package com.memoir.jpa.repository;

import com.memoir.jpa.model.TodoDto;
import org.springframework.beans.factory.annotation.Autowired;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

//注意扩展的是TodoRepository，名字必须是TodoRepositoryImpl
public class TodoRepositoryImpl implements TodoExtendRepository {


    @PersistenceContext
    @Autowired
    EntityManager entityManager;    //相当于sqlsession，connection

    @Override
    public TodoDto custom(int id) {

        TodoDto todoDto = entityManager.find(TodoDto.class, id);
        System.out.println("==>" + todoDto);
        return todoDto;

    }
}
